<?php session_start(); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<head>
	<meta charset="utf-8">
    <title>dv_payments Payment Edit</title>
<?php echo link_tag(my_url().'skin.css'); ?>
<?php echo link_tag(my_url().'tcal.css'); ?>
<?php echo link_tag(my_url().'form.css'); ?>
<script type="text/javascript" src="<?php echo my_url(); ?>js/1.js"></script>
<script type="text/javascript" src="<?php echo my_url(); ?>js/jquery-1.2.6.js"></script>
<script type="text/javascript" src="<?php echo my_url(); ?>tcal.js"></script> 
<script type="text/javascript" src="<?php echo my_url(); ?>formatcurrency-1.4.0.js"></script> 
<script type="text/javascript" src="../js/1.js"></script>
<script src="<?php echo my_url(); ?>js/AC_RunActiveContent.js" type="text/javascript"></script>
<script type="text/javascript" src="<?php echo my_url(); ?>jquery.js"></script>
<script language="javascript" type="text/javascript">
 var BaseURL='<?php echo base_url(); ?>';
function redirect(location){
	window.location.href= location;
}
$(document).ready(function(){
	 $('.bal').keyup(function() {   
   	  var ca=$('input[name=contract_amount]').val();  
	  var ad1=$('input[name=advance1]').val();
	   var ad2=$('input[name=advance2]').val(); 	
     var da=$('input[name=detention_amnt]').val(); 		  
  	  var la=$('input[name=l_amount]').val(); 	 
	  var fa=$('input[name=f_amount]').val(); 
	
	  var ca_val=0.00;
	  var ad1_val=0.00;
	  var ad2_val=0.00;		  
      var da_val=0.00;		  
	  var la_val=0.00;
	  var fa_val=0.00;
	   if(!isNaN(ca) && ca!=""){
		   ca_val=parseFloat(ca);
		  }
		  if(!isNaN(ad1) && ad1!=""){
			ad1_val=parseFloat(ad1);
		  }
		    var ad1_bal=ca-ad1;
		  $('input[name=balance_ad1]').val(ad1_bal); 		

		 if(!isNaN(ad1_bal) && ad1_bal!=""){
			ad1_bal_val=parseFloat(ad1_bal);
		  }
		 if(!isNaN(ad2) && ad2!=""){
			ad2_val=parseFloat(ad2);
		  }
		 var ad2_bal=ad1_bal-ad2;
		  $('input[name=balance_ad2]').val(ad2_bal); 	    
		  if(!isNaN(da) && da!=""){
			da_val=parseFloat(da);
		  }
  		  if(!isNaN(la) && la!=""){
			la_val=parseFloat(la);
		  }
		  var dl_bal=da_val+la_val;
		  $('input[name=dl_balance]').val(dl_bal); 
		      if(!isNaN(dl_bal) && dl_bal!=""){
			dl_bal_val=parseFloat(dl_bal);
		  }
		  if(!isNaN(fa) && fa!=""){
			fa_val=parseFloat(fa);
		  }		
		    var f_bal=(ad2_bal-fa_val)+dl_bal;
		  $('input[name=f_balance]').val(f_bal); 
		
    });
});
</script>
<link rel="stylesheet" href="../skin.css" type="text/css" media="screen" /><meta name="author" content="Jaypee Mahilum" />
<link rel="stylesheet" href="style.css" type="text/css" media="screen" />
<link href="skin.css" rel="stylesheet" type="text/css" />
</head>
<?php
//echo $_SESSION['administrator_log']."============";
if(!isset($_SESSION['administrator_log']))
{
		echo"Log in first to access this page<html><title>WARNING</title><body><br><a href='".base_url()."administrator' />click here to log in.</a></body></html>";
}
else
{
?>
<body >
	<div class="BodyCover">
 		<div class="ParentContent">
	        <?php require("owner_menu.php"); ?>
			<div class="MenuTab">
    			<div class="MenuBelow"><img src="<?php echo my_url();?>images/below-menu.gif"></div>        
             </div>
			<br /><br />	
			<div class="module-index1">
		  		<div align="right"><a href="<?php echo base_url()?>admin/logout" style="color:#FF0000;">logout</a></div><br/>
  	                <p class=""><?php if (isset($recordflag)) {echo $recordflag;}?><p>
      
                        <form action="<?php echo base_url()?>dv_payments/p_edit_dv_payments/" method="post">
                        <fieldset><legend> Edit Payment info</legend>
    	                    <fieldset >
                            <div id="col1">
                                <input type="hidden" name="hid_dv_payment_id" value="<?php echo $info->dv_payment_id ?>"  />
                                <label for="load_no">Load No.:</label>
                                <label for="dv_company_name">Driver Company:</label>
                               <label for="contract_amount" >Contract_amount:</label>
                            </div>
                            <div id="col2">
                               <input type="text" name="load_no" id="load_no"value="<?php echo $info->load_no ?>" />
                               <input type="text" name="dv_company_name" value="<?php echo $info->dv_company_name ?>" />
                               <input type="text" name="contract_amount" class="bal" id="currency" value="<?php echo $info->contract_amount ?>" />
                            </div>
                            </fieldset>
                            <fieldset><legend>Advances</legend>
                             <div id="col1">
                                <label for="advance_ad1">Advance1:</label>
                                <label for="type1">Type:</label>
								<label for="date1">Date:</label>
                                <label for="reference1">Reference:</label>
                                <label for="ref_name1">Reference Name:</label>
                                <label for="balance_ad1">Ad1_Balance:</label>                                
                             </div>
                             <div id="col2">
                               <input type="text" name="advance1" class="bal"  value="<?php echo $info->advance1 ?>" />
                               <?php  echo select_list("p_type","p_type","p_type","id","","name=type1",$info->type1); ?> 
                               <input type="text" name="date1" class="tcal" value="<?php echo $info->date1 ?>" />
                               <input type="text" name="reference1" value="<?php echo $info->reference1 ?>" />
                               <input type="text" name="ref_name1" value="<?php echo $info->ref_name1 ?>" />
                               <input type="text" name="balance_ad1" value="<?php echo $info->balance_ad1 ?>" />                              
                           </div>
                            <div id="col3">
	                           <label  for="advance2">Advance2:</label>
                                <label  for="type2">Type:</label>
								<label  for="date2">Date:</label>
                                <label  for="reference2">Reference:</label>
                                <label  for="ref_name2">Reference Name:</label>
                               <label  for="balance_ad1">Ad2_Balance:</label>            
                          </div>
                            <div id="col4">
                               <input type="text" name="advance2" class="bal" id="currency" value="<?php echo $info->advance2 ?>" />
                               <?php  echo select_list("p_type","p_type","p_type","id","","name=type2",$info->type2); ?> 
                               <input type="text" name="date2" class="tcal" value="<?php echo $info->date2 ?>" />
                               <input type="text" name="reference2" value="<?php echo $info->reference2 ?>" />
                              <input type="text" name="ref_name2" value="<?php echo $info->ref_name2 ?>" />
                               <input type="text" name="balance_ad2" id="currency" value="<?php echo $info->balance_ad2 ?>" />         
                            </div>
                            </fieldset>
                         
                           <fieldset><legend>Detention and Lumpar</legend>
                             <div id="col1">
                                <label for="detention_amnt">Detention Amount:</label>
                                <label for="description_time">Description Time</label>
								<label for="lumpar">Lumpar</label>
                                <label for="l_amount">Amount</label>
                                <label for="description">Description:</label>
                                <label for="dl_balance">Balance:</label>                                
                             </div>
                             <div id="col2">
                               <input type="text" name="detention_amnt" class="bal" id="currency" value="<?php echo $info->detention_amnt ?>" />
                               <input type="text" name="description_time" value="<?php echo $info->description_time ?>" />
                               <input type="text" name="lumpar" value="<?php echo $info->lumpar ?>" />
                               <input type="text" name="l_amount" class="bal" value="<?php echo $info->l_amount ?>" />
                               <input type="text" name="description" value="<?php echo $info->description ?>" />
                               <input type="text" name="dl_balance"  id="currency" value="<?php echo $info->dl_balance ?>" />                               
                            </div>
                            </fieldset><fieldset><legend>Final Payment</legend>
                             <div id="col1">
                                <label for="f_amount">Amount:</label>
                                <label for="f_type">Type:</label>
								<label for="f_date">Date:</label>
                                <label for="f_reference">Reference:</label>
                                <label for="f_balance">Final Balance:</label>                                
                             </div>
                            <div id="col2">
                               <input type="text" name="f_amount" id="currency" class="bal" value="<?php echo $info->f_amount?>" />
                               <?php  echo select_list("p_type","p_type","p_type","id","","name=f_type",$info->f_type); ?> 
                               <input type="text" name="f_date" class="tcal" value="<?php echo $info->f_date ?>" />
                               <input type="text" name="f_reference" value="<?php echo $info->f_reference ?>" />
                               <input type="text" name="f_balance" id="currency" value="<?php echo $info->f_balance ?>" />                               

                            </div>
                            </fieldset><br /><br />
                           	<p><input type="submit"  value="Save" name="cmdsave" id="cmdsave">                               
								<input type="button"  value="Cancel" onclick="redirect(BaseURL+'dv_payments')" name="cmdcancel"></p>
                                </form>
                            </fieldset>
    		<br><br /><br />

           <div class="BodyContent">
            </div>	

		    <div class="Footer1">	
                <div class="Footer">Copyright &copy; 2011. All Rights Reserved <br><br>
                 <a href="http://webmartis.com"> <img src="<?php echo my_url();?>images/wmlink.png"></a>
                </div>                
            </div> <!---end of Footer1 ---->        
		</div><!---end of ParentContent ---->
    </div> <!---end of BodyCover ---->
</body>

<?php } ?>

</html>



